import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DissentVO, DissentQuery, tokenForm, orgVO, cfItemVo } from '@/api/xydz/dissent/types';

// 获取token
export const getToken = (menuName, data: tokenForm) => {
  return request({
    url: '/xydz/credit/user/check?menuName=' + menuName,
    method: 'post',
    data: data
  });
};

// ******************** admin ******************
/**
 * 查询异议信息列表
 * @param query
 * @returns {*}
 */

export const listDissent = (query?: DissentQuery): AxiosPromise<DissentVO[]> => {
  return request({
    url: '/xydz/credit/dissent/dissentList',
    method: 'post',
    params: query
  });
};

// 获取异议详情
export const getDissentDetail = (id: string): AxiosPromise<cfItemVo[]> => {
  return request({
    url: '/xydz/credit/dissent/dissentDetails/' + id,
    method: 'get'
  });
};

// 获取转办人列表
export const getDissentOrgList = (query?: DissentQuery): AxiosPromise<orgVO[]> => {
  return request({
    url: '/xydz/credit/dissent/orgList',
    method: 'get',
    params: query
  });
};

//转办
export const dissentTransfer = (data) => {
  return request({
    url: '/xydz/credit/dissent/turn',
    method: 'post',
    data: data
  });
};

//驳回/完成
export const rejectOrComplete = (id: string, query) => {
  return request({
    url: '/xydz/credit/dissent/modification/' + id,
    method: 'get',
    params: query
  });
};
